package com.design_pattern.builder;

public class MilkTea {
    // 构造后理论上不应该再改了
    private final int size;
    private final String ice;


    private MilkTea(Builder builder) {
        this.size = builder.size;
        this.ice = builder.ice;
    }

    public int getSize() {
        return size;
    }

    public String getIce() {
        return ice;
    }

    public static class Builder {
        private int size = 1;
        private String ice = "builder";

        public Builder() {
        }

        public Builder size(int size) {
            this.size = size;
            return this;
        }

        public Builder ice(String ice) {
            this.ice = ice;
            return this;
        }

        public MilkTea build() {
            return new MilkTea(this);
        }
    }
}
